package com.lsl.learn.springcloud.controller;

import com.lsl.learn.springcloud.pojo.Dept;
import com.lsl.learn.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * 消费者不应该有service层，因为消费者不应该关心这些
 *
 * @ClassName DeptConsumerController
 * @Description TODO
 * @Author LSL
 * @Date 2019/8/17 13:22
 * @Version 1.0
 * @Email lsl.yx@foxmail.com
 **/
@RestController
public class DeptConsumerController {

    @Autowired
    private DeptClientService deptClientService;

    @RequestMapping(value = "/consumer/dept/addition")
    public boolean addition(@RequestBody Dept dept) {
        return deptClientService.addition(dept);
    }

    @RequestMapping(value = "/consumer/dept/number/{id}")
    public Dept number(@PathVariable("id") Long id) {
        return deptClientService.number(id);
    }

    @RequestMapping(value = "/consumer/dept/all")
    public List<Dept> all() {
        return deptClientService.all();
    }

}
